import requests

from WEB.app import app
from WEB.app.models.AdminImportEmail import AdminImportEmail


def test_login():
    user_info = {'name': 'aiweline', 'email': 'aiweline@qq.com', 'password': 'aiweline123',
                 'check_password': 'aiweline123'}
    res = requests.post('http://127.0.0.1:516/login', data=user_info)
    print(res)


def read_file():
    file_path = "E:\\WorkerSpace\\CP516\\InternetCelebrityDiscoverSpider\\WEB\\app\\upload\\admin\\202142\\56fe6b44-946d-4058-9d62-5c7be37e75f8.txt"
    file = open(file_path, 'r', encoding='utf-8')
    for line in file:
        admin_import_email = AdminImportEmail()
        try:
            email = line.split(':')[0]
            admin_import_email.importer_user_id = 1
            admin_import_email.email = email
        except Exception:
            pass


if __name__ == '__main__':
    # test_login()
    read_file()
